package com.zoe.app.entity;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @Author Zoe.Zhang
 * @Date: 2021/09/21
 * @Description
 */
@Component
// 加载指定位置配置文件
@PropertySource(value = {"classpath:animal.properties"})
@ConfigurationProperties(prefix = "animal")
public class Animal {
    private String name;
    private String sex;
    private String[] tags;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        System.out.println("setName" + name);
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public String[] getTags() {
        return tags;
    }

    public void setTags(String[] tags) {
        this.tags = tags;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Animal{" +
            "name='" + name + '\'' +
            ", sex='" + sex + '\'' +
            ", tags=" + Arrays.toString(tags) +
            '}';
    }
}
